package self.niu.com.resume.db.dao.impl;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.exception.DbException;
import java.util.List;
import self.niu.com.resume.AppBase;
import self.niu.com.resume.db.KnowAbility;
import self.niu.com.resume.db.dao.KnowAbilityDao;

/**
 * Created by Administrator on 2015/9/27 0027.
 */
public class KonwAbilityDaoImpl implements KnowAbilityDao {
    private DbUtils db;
    public KonwAbilityDaoImpl(){
        this.db = AppBase.db;
    }
    @Override
    public void update(KnowAbility know, String numberCusor) {
        try {
            db.update(know,numberCusor);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void save(KnowAbility konw) {
        try {
            db.save(konw);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void deleteById(int id) {

    }

    @Override
    public KnowAbility find(String name) {

        return null;
    }

    @Override
    public List<KnowAbility> findAll() {
        List<KnowAbility> know = null;
        try {
            know = db.findAll(KnowAbility.class);
        } catch (DbException e) {
            e.printStackTrace();
        }
        return know;
    }

    @Override
    public void createDb(Class t) {
        try {
            db.createTableIfNotExist(t);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }
}
